<div>
    <div>
        <button nz-button nzType="primary" (click)="add()">+ 新增</button>
        <a nz-button nzType="default" (click)="edit()">修改</a>
        <a nz-button nzType="default" (click)="copy()">查看注册地址</a>
        <button nz-button nzType="primary" style="float: right">导入职工设置数据</button>
    </div>
    <nz-table #basicTable nzSize="small" [nzData]="personnelList" [nzLoading]="isLoading" [nzScroll]="{ x: '1775px'}" class="medical-table">
        <thead>
            <tr>
                <th nzWidth="50px" nzLeft="0px"></th>
                <th nzWidth="100px" nzLeft="50px">职工编码</th>
                <th nzWidth="100px" nzLeft="150px">职工姓名</th>
                <th nzWidth="120px" nzLeft="250px">证书代码</th>
                <th nzWidth="120px">科室名称</th>
                <th nzWidth="120px">职工类别</th>
                <th nzWidth="120px">职称名称</th>
                <th nzWidth="200px">邮箱</th>
                <th nzWidth="125px">联系电话</th>
                <th nzWidth="120px">CA图片</th>
                <th nzWidth="120px">使用状态</th>
                <th nzWidth="120px">操作员</th>
                <th nzWidth="180px">更新日期</th>
                <th nzWidth="180px">备注</th>
                <th nzWidth="120px" nzRight="0px">审核状态</th>
            </tr>
        </thead>
        <tbody>
            <tr *ngFor="let data of basicTable.data" [ngClass]="{'selectedRow':selectedRowData.id === data.id}" (click)="selectedRow(data)">
                <td nzLeft="0px" style="background: #fff;"><span class="checkbox" [ngClass]="{active:selectedRowData.id === data.id}"><i nz-icon nzType="check" nzTheme="outline"></i></span></td>
                <td nzLeft="50px">{{ data.staffNo }}</td>
                <td nzLeft="150px">{{ data.contactName }}</td>
                <td nzLeft="250px">{{ data.certId }}</td>
                <td>{{ data.departmentName }}</td>
                <td>{{ data.staffTypeName }}</td>
                <td>{{ data.proTitleName }}</td>
                <td>{{ data.contactEmail }}</td>
                <td>{{ data.contactMobile }}</td>
                <td>{{ data.departmentName }}</td>
                <td>{{ data.useStatus === 'Y'?'正常':'停用' }}</td>
                <td>{{ data.operaterId }}</td>
                <td>{{ data.editTime }}</td>
                <td>{{ data.memo }}</td>
                <td nzRight="0px">
                    <nz-tag *ngIf="data.regStatus === 'CREATE'" [nzColor]="'#2db7f5'">预申请</nz-tag>
                    <nz-tag *ngIf="data.regStatus === 'AUDIT'" [nzColor]="'#108ee9'">审核中</nz-tag>
                    <nz-tag *ngIf="data.regStatus === 'NOPASS'" [nzColor]="'#f50'">审核未通过</nz-tag>
                    <nz-tag *ngIf="data.regStatus === 'APPROVE'" [nzColor]="'#87d068'">审核通过</nz-tag>
                </td>
            </tr>
        </tbody>
    </nz-table>
    <nz-modal [(nzVisible)]="isVisible2" [nzFooter]="null" nzTitle="职工注册地址"  (nzOnCancel)="isVisible2 = false">
            <nz-input-group nzSearch nzSize="small" [nzAddOnAfter]="suffixButton">
                <input type="text" nz-input [value]="url+'/#/pages/doctor-register/one?preUserId='+selectedRowData.id+'&institType=HOSPITAL'" />
            </nz-input-group>
            <ng-template #suffixButton>
                <button nz-button nzType="primary" nzSize="large" nzSearch>复制</button>
            </ng-template>
    </nz-modal>
    <nz-modal [(nzVisible)]="isVisible" nzTitle="新增职工" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" [nzWidth]="1000">
        <form nz-form [formGroup]="validateForm">
            <nz-form-item>
                <nz-form-label [nzSm]="4" [nzXs]="24" nzRequired nzFor="staffNo">职工编号</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [(nzValidateStatus)]="validateForm.controls.staffNo">
                    <input nz-input formControlName="staffNo" id="staffNo" placeholder="请输入职工编号" />
                    <nz-form-explain *ngIf="validateForm.get('staffNo')?.dirty && validateForm.get('staffNo')?.errors">职工编号不能为空！</nz-form-explain>
                </nz-form-control>
                <nz-form-label [nzSm]="5" [nzXs]="24" nzRequired nzFor="contactName">职工姓名</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [(nzValidateStatus)]="validateForm.controls.contactName">
                    <input nz-input formControlName="contactName" id="contactName" placeholder="请输入职工姓名" />
                    <nz-form-explain *ngIf="validateForm.get('contactName')?.dirty && validateForm.get('contactName')?.errors">职工姓名不能为空！</nz-form-explain>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label [nzSm]="4" [nzXs]="24" nzRequired nzFor="contactMobile">职工手机</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [(nzValidateStatus)]="validateForm.controls.contactMobile">
                    <input nz-input formControlName="contactMobile" id="contactMobile" placeholder="请输入手机号码" />
                    <nz-form-explain *ngIf="validateForm.get('contactMobile')?.dirty && validateForm.get('contactMobile')?.errors">请输入正确的手机号码！</nz-form-explain>
                </nz-form-control>
                <nz-form-label [nzSm]="5" [nzXs]="24" nzRequired nzFor="contactEmail">职工邮箱</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [(nzValidateStatus)]="validateForm.controls.contactEmail">
                    <input nz-input formControlName="contactEmail" id="contactEmail" placeholder="请输入职工邮箱" />
                    <nz-form-explain *ngIf="validateForm.get('contactEmail')?.dirty && validateForm.get('contactEmail')?.errors">请输入正确的邮箱！</nz-form-explain>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label [nzSm]="4" [nzXs]="24" nzRequired nzFor="certId">证书编号</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [(nzValidateStatus)]="validateForm.controls.certId">
                    <input nz-input formControlName="certId" id="certId" placeholder="请输入证书编号" />
                    <nz-form-explain *ngIf="validateForm.get('certId')?.dirty && validateForm.get('certId')?.errors">证书编号不能为空！</nz-form-explain>
                </nz-form-control>
                <nz-form-label [nzSm]="5" [nzXs]="24" nzFor="departmentId" nzRequired>科室</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [nzValidateStatus]="validateForm.get('departmentId')">
                    <nz-select style="width: 100%;" formControlName="departmentId" (ngModelChange)="changeDepartment($event)">
                        <nz-option [nzValue]="item.id" [nzLabel]="item.departmentName" *ngFor="let item of departmentList"></nz-option>
                    </nz-select>
                    <nz-form-explain *ngIf="validateForm.get('departmentId')?.dirty && validateForm.get('departmentId')?.errors">科室类别不能为空！</nz-form-explain>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="staffTypeId" nzRequired>职工类别</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [nzValidateStatus]="validateForm.get('staffTypeId')">
                    <nz-select style="width: 100%;" formControlName="staffTypeId" (ngModelChange)="changestaffType($event)">
                        <nz-option [nzValue]="item.id" [nzLabel]="item.name" *ngFor="let item of staffTypeList"></nz-option>
                    </nz-select>
                    <nz-form-explain *ngIf="validateForm.get('staffTypeId')?.dirty && validateForm.get('staffTypeId')?.errors">请选择职工类别！</nz-form-explain>
                </nz-form-control>
                <nz-form-label [nzSm]="5" [nzXs]="24" nzFor="proTitleId" nzRequired>职称</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [nzValidateStatus]="validateForm.get('proTitleId')">
                    <nz-select style="width: 100%;" formControlName="proTitleId">
                        <nz-option [nzValue]="item.id" [nzLabel]="item.name" *ngFor="let item of proTitleList"></nz-option>
                    </nz-select>
                    <nz-form-explain *ngIf="validateForm.get('proTitleId')?.dirty && validateForm.get('proTitleId')?.errors">请选择职称！</nz-form-explain>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item *ngIf="selectedRowData && selectedRowData.id">
                <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="useStatus" nzRequired>记录状态</nz-form-label>
                <nz-form-control [nzSm]="7" [nzXs]="24" [nzValidateStatus]="validateForm.get('useStatus')">
                    <nz-select style="width: 100%;" formControlName="useStatus">
                        <nz-option nzValue="Y" nzLabel="正常"></nz-option>
                        <nz-option nzValue="N" nzLabel="停用"></nz-option>
                    </nz-select>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="memo">备注</nz-form-label>
                <nz-form-control [nzSm]="19" [nzXs]="24" [nzValidateStatus]="validateForm.get('memo')">
                    <textarea nz-input formControlName="memo" id="memo" placeholder="备注..."></textarea>
                </nz-form-control>
            </nz-form-item>
        </form>
    </nz-modal>
</div>
